package com.ssoserver.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ssoserver.pojo.User;
import com.ssoserver.service.UserService;
import com.ssoserver.utils.JsonAndView;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/test")
    public JsonAndView findTest(){
        List<User> list = userService.findAll();
        log.info("打印查询得到的数据：{}",JSONObject.toJSON(list));
        return JsonAndView.success(list);
    }
}
